//
//  WYMediaDetailMessageCell.m
//  CirclePush
//
//  Created by admin on 2018/5/19.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYMediaDetailMessageCell.h"
@interface WYMediaDetailMessageCell()
@property (strong, nonatomic) IBOutlet UILabel *mediaTitle;
@property (strong, nonatomic) IBOutlet UILabel *priceLabel;
@property (strong, nonatomic) IBOutlet UIButton *minimumBtn;
@property (strong, nonatomic) IBOutlet UILabel *mediaType;
@property (strong, nonatomic) IBOutlet UILabel *putCycle;
@property (strong, nonatomic) IBOutlet UILabel *putTime;
@property (strong, nonatomic) IBOutlet UILabel *industryLabel;

@end


@implementation WYMediaDetailMessageCell
-(void)setModel:(WYMediaModel *)model
{
    _model = model;
    self.mediaTitle.text = model.mediaTitle;
    self.priceLabel.text = model.publishPrice;
    //self.mediaType.text  = model.me
    self.putCycle.text = model.launchCycle;
    self.putTime.text = [NSString stringWithFormat:@"%@-%@",[self creatTimeForTimeInterval:model.launchTime],[self creatTimeForTimeInterval:model.launchEndTime]];
    self.industryLabel.text = model.industryRestrictions;
    
    if (model.isUse.integerValue) {
        self.minimumBtn.hidden = NO;
    }else{
        self.minimumBtn.hidden = YES;
        
    }
    
    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    
    [self.minimumBtn setBorderWithWidth:kLineHeight andColor:[UIColor blueColor]];
    [self.minimumBtn setCornerRadius:5.0f];
    
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)clickMinimumAciton:(id)sender {
    if ([self.delegate respondsToSelector:@selector(clickGetMinPrice)]) {
        [self.delegate clickGetMinPrice];
    }
    
    
    
}

-(NSString *)creatTimeForTimeInterval:(NSString *)timeInterVal
{
    //NSString *timeStampString  = orderMessage.waitTime;
    // iOS 生成的时间戳是10位
    NSTimeInterval interval    =[timeInterVal doubleValue] / 1000.0;
    NSDate *date               = [NSDate dateWithTimeIntervalSince1970:interval];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSString *TempString       = [formatter stringFromDate: date];
    return TempString;
    
}


-(void)setType:(NSString *)type
{
    _type = type;
    self.mediaType.text = type;
}


@end
